<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>V2 - {{ question.question_text }}</title>
</head>
<body>
    <h2>表单投票 - V2</h2>
    <form action="{% url 'polls:v2-polls-vote' question.id %}" method="post">
        {% csrf_token %}
        <!-- 知识点: fieldset 及 legend -->
        <fieldset>
            <legend>
                <h1>{{ question.question_text }}</h1>
            </legend>
            {% if error_message %}
                <p><strong>{{ error_message }}</strong></p>
            {% endif %}
            {% for choice in question.choice_set.all %}
                <!-- 知识点: django 模板for循环中 forloop 使用 -->
                <input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}">
                <label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label>
                <br>
            {% endfor %}
        </fieldset>
        <input type="submit" value="Vote投票">
    </form>

<p>
        <a href="{% url 'polls:v2-polls-index' %}">返回首页</a>
    </p>
</body>
</html>